﻿
using MSAcademic.v2.Infrastructure.AccessRights;
using MSAcademic.v2.Infrastructure.AccessRights.Impl;
using MSAcademic.v2.Infrastructure.Gallery;
using MSAcademic.v2.Infrastructure.Gallery.Impls;
using MSAcademic.v2.Infrastructure.Login;
using MSAcademic.v2.Infrastructure.Login.Impl;
using MSAcademic.v2.Infrastructure.PasswordRecovery;
using MSAcademic.v2.Infrastructure.PasswordRecovery.Impl;
using MSAcademic.v2.Infrastructure.Picture;
using MSAcademic.v2.Infrastructure.Picture.Impl;
using MSAcademic.v2.Infrastructure.User;
using MSAcademic.v2.Infrastructure.User.Impl;

using StructureMap;
using StructureMap.Configuration.DSL;
using MSAcademic.v2.Infrastructure.Article;
using MSAcademic.v2.Infrastructure.Article.Impl;
using MSAcademic.v2.Infrastructure.Tag;
using MSAcademic.v2.Infrastructure.Tag.Impl;
using MSAcademic.v2.Infrastructure.Search;
using MSAcademic.v2.Infrastructure.Search.Impl;
using MSAcademic.v2.Infrastructure.ContentSection;
using MSAcademic.v2.Infrastructure.SubSection;
using MSAcademic.v2.Infrastructure.ContentSection.Impl;
using MSAcademic.v2.Infrastructure.SubSection.Impl;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;

namespace MSAcademic.v2.Infrastructure
{
    public class DebugDependencyRegistry : Registry
    {
        public DebugDependencyRegistry()
        {
            ObjectFactory.Configure(x =>
            {
                //this.For<ISectionCommands>().Use<SectionCommandsImpl>();
                this.For<ITagQueries>().Use<TagQueriesImpl>();
                this.For<ITagCommand>().Use<TagCommandImpl>();
                x.For<IPictureService>().Use<PictureService>();
                x.For<IGalleryCommands>().Use<GalleryCommandsImpl>();
                x.For<IGallery>().Use(m => new GalleryImpl());
                x.For<IArticle>().Use(m => new ArticleImpl());
                x.For<IArticleQueries>().Use<ArticleQueriesImpl>();
                x.For<IArticleCommands>().Use<ArticleCommandsImpl>();
                x.For<IGalleryQueries>().Use<GalleryQueriesImpl>();
                x.For<IPictureCommands>().Use<PictureCommandsImpl>();
                x.For<IPictureQueries>().Use<PictureQueriesImpl>();
                x.For<IArticleQueries>().Use<ArticleQueriesImpl>();
                
                x.For<ILoginService>().Use<HttpCookieLoginService>();
                x.For<IPasswordRecoveryService>().Use<DatabasePasswordRecoveryService>();
                x.For<IUserQueries>().Use<DatabaseUserQueries>();
                x.For<IUserCommands>().Use<DatabaseUserCommands>();

                x.For<IAccessRightsService>().Use<AccessRightsServiceImpl>();
               
                x.For<ISearchQueries>().Use<SearchQueriesImpl>();
                x.For<IArticleRssService>().Use<ArticleRssService>();

                this.For<IContenSectionQueries>().Use<ContenSectionQueriesImpl>();
                this.For<ISubSectionCommand>().Use<SubSectionCommandImpl>();
                this.For<ISubSectionQueries>().Use<SubSectionQueriesImpl>();
            });
        }
    }

    public class ProductionDependencyRegistry : Registry
    {
        public ProductionDependencyRegistry()
        {
            ObjectFactory.Configure(x =>
            {
                this.For<ITagQueries>().Use<TagQueriesImpl>();
                this.For<ITagCommand>().Use<TagCommandImpl>();
                x.For<IPictureService>().Use<BlobPictureService>();
                x.For<IGalleryCommands>().Use<GalleryCommandsImpl>();
                x.For<IGallery>().Use(m => new GalleryImpl());
                x.For<IArticle>().Use(m => new ArticleImpl());
                x.For<IArticleQueries>().Use<ArticleQueriesImpl>();
                x.For<IArticleCommands>().Use<ArticleCommandsImpl>();
                x.For<IGalleryQueries>().Use<GalleryQueriesImpl>();
                x.For<IPictureCommands>().Use<PictureCommandsImpl>();
                x.For<IPictureQueries>().Use<PictureQueriesImpl>();
                x.For<IArticleQueries>().Use<ArticleQueriesImpl>();

                x.For<ILoginService>().Use<HttpCookieLoginService>();
                x.For<IPasswordRecoveryService>().Use<DatabasePasswordRecoveryService>();
                x.For<IUserQueries>().Use<DatabaseUserQueries>();
                x.For<IUserCommands>().Use<DatabaseUserCommands>();

                x.For<IAccessRightsService>().Use<AccessRightsServiceImpl>();

                x.For<ISearchQueries>().Use<SearchQueriesImpl>();
                x.For<IArticleRssService>().Use<ArticleRssService>();

                this.For<IContenSectionQueries>().Use<ContenSectionQueriesImpl>();
                this.For<ISubSectionCommand>().Use<SubSectionCommandImpl>();
                this.For<ISubSectionQueries>().Use<SubSectionQueriesImpl>();
            });
        }
    }
}
